#ifndef __COMMU_DATA__
#define __COMMU_DATA__

namespace dta
{
	enum CMDCLS 
	{
		CMD_MARK_TAINT,
		CMD_QUERY_TAINT,
	};

	struct COMM_DATA
	{
		enum { MARK = '!DTA' };
		unsigned int mark; // 
		CMDCLS cmdcls;
		 long lr;
		union
		{
			struct _mark_taint
			{
				size_t	buffer;
				size_t	bytes;
				size_t	tof;
			} mark_taint;

			struct _query_taint
			{
				size_t	buffer;
				size_t	bytes;
			} query_taint;
		} u;
	};

#ifdef _WINDOWS_

	long communicate( COMM_DATA * data, size_t size )
	{
		data->mark = COMM_DATA::MARK;
		data->lr = E_UNEXPECTED;
		::ReadProcessMemory( (HANDLE)dta::COMM_DATA::MARK, 0, data, size, 0 );
		return data->lr;
	}

	static long mon_mark_taint( const void * p, size_t bytes, bool is )
	{
		dta::COMM_DATA k = {};
		k.cmdcls = dta::CMDCLS::CMD_MARK_TAINT;
		k.u.mark_taint.buffer = (size_t)p;
		k.u.mark_taint.bytes = bytes;
		k.u.mark_taint.tof = is;
		return communicate( &k, sizeof(k) );
	}

	static long mon_test_taint( const void * p, size_t bytes )
	{
		dta::COMM_DATA k = {};
		k.cmdcls = dta::CMDCLS::CMD_QUERY_TAINT;
		k.u.query_taint.buffer = (size_t)p;
		k.u.query_taint.bytes = bytes;
		return communicate( &k, sizeof(k) );
	}

#endif


};


#endif